/*
 *
100	90	80	70	60	
80	60	60	60	50	40	30	
L2: sum=380
10	20	30	40	50	60	70	80	90	100
 */
#include <iostream>
#include <list>
using namespace std;
int main(void){

	int i = 0;
	list<int> L1, L2, L3(10);
	list<int>::iterator iter;
	int a1[] = {100,90,80,70,60};
	int a2[] = {30,40,50,60,60,60,80};
	for(i=0; i<5; i++)
		L1.push_back(a1[i]);
	for(i=0; i<7; i++)
		L2.push_back(a2[i]);
	for(iter = L1.begin(); iter!=L1.end(); iter++){
		cout << *iter << "\t";
	}
	cout << endl;
	
	int sum = 0;
	//for(iter=--L2.end(); iter!=L2.begin(); iter--){
	iter = L2.end();
	do{
		iter--;
		cout << *iter << "\t";
		sum += *iter;
	}while(iter != L2.begin());
	cout << "\nL2: sum=" << sum << endl;
	
	int data = 0;
	for(iter=L3.begin(); iter!=L3.end(); iter++)
		*iter = data+=10;
	for(iter = L3.begin(); iter!=L3.end(); iter++){
		cout << *iter << "\t";
	}
	cout << endl;
	
	return 0;
}
